package cn.invest.merry.module.invest.controller.admin.juchao;

import cn.invest.merry.framework.common.pojo.CommonResult;
import cn.invest.merry.module.invest.service.JuchaoServiceImpl;
import cn.invest.merry.module.invest.service.vo.BaseVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import static cn.invest.merry.framework.common.pojo.CommonResult.success;

@Tag(name="巨潮同步")
@RestController
@RequestMapping("/invest/juchao")
public class JuchaoController {
    @Autowired
    JuchaoServiceImpl service;
    @GetMapping("/getToken")
    @Operation(summary = "getToken")
    public CommonResult<String> getToken() {
        String token = service.getToken();
        return success(token);
    }
    @PostMapping("/gsbase")
    @Operation(summary = "初始化公司基本信息")
    @PreAuthorize("@ss.hasPermission('invest:juhcao:gsbase')")
    public CommonResult<Boolean> initGsBase(@RequestBody BaseVo baseVo) {
        return success(service.initGsBaseFromJuchao(baseVo));
    }
}
